package cn.iocoder.yudao.module.crm.dal.mysql.receipttitle;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crm.dal.dataobject.receipttitle.ReceiptTitleDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crm.controller.admin.receipttitle.vo.*;

/**
 * crm发票抬头 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface ReceiptTitleMapper extends BaseMapperX<ReceiptTitleDO> {

    default PageResult<ReceiptTitleDO> selectPage(ReceiptTitlePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReceiptTitleDO>()
                .eqIfPresent(ReceiptTitleDO::getTitleType, reqVO.getTitleType())
                .eqIfPresent(ReceiptTitleDO::getTitle, reqVO.getTitle())
                .eqIfPresent(ReceiptTitleDO::getTaxCode, reqVO.getTaxCode())
                .likeIfPresent(ReceiptTitleDO::getBankName, reqVO.getBankName())
                .eqIfPresent(ReceiptTitleDO::getBankAccount, reqVO.getBankAccount())
                .eqIfPresent(ReceiptTitleDO::getReceiptAddress, reqVO.getReceiptAddress())
                .eqIfPresent(ReceiptTitleDO::getPhoneNumber, reqVO.getPhoneNumber())
                .betweenIfPresent(ReceiptTitleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ReceiptTitleDO::getOwnerUserId, reqVO.getOwnerUserId())
                .eqIfPresent(ReceiptTitleDO::getCustomerId, reqVO.getCustomerId())
                .orderByDesc(ReceiptTitleDO::getId));
    }

}